/*
 * Copyright (C) 2012 Virglinio & Asociados
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.virglinio.telemedicina.rehabilitacion.openGL;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.util.Log;

public class Rehabilitacion3DOpenGLActivity extends Activity {
	
	/**
     * Set to true to add debugging code and logging.
     */
    private static final boolean DEBUG = true;
    
    /**
     * The tag we use when logging, so that our messages can be distinguished
     * from other messages in the log. Public because it's used by several
     * classes.
     */
	private static final String TAG = "Rehabilitacion3DOpenGLActivity";
    
	private GLSurfaceView glSurfaceView;
	
	/**
     * Used to temporarily hold data received from the remote process. Allocated
     * once and used permanently to minimize heap thrashing.
     */
    public static byte[] receiveBuffer;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (DEBUG){
        	Log.e(TAG, "+++ ON CREATE +++");
        }
        glSurfaceView = new GLSurfaceView(this);
        glSurfaceView.setRenderer(new GLRenderer(this));
        setContentView(glSurfaceView);
        
        if (DEBUG){
        	Log.e(TAG, "+++ DONE IN ON CREATE +++");
        }
    }    
    
    @Override
	public void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		if (DEBUG){
			Log.e(TAG, "+++ ON START +++");
		}		
	}

    // Call back after onStart()
    @Override
    protected void onResume() {
    	super.onResume();
    	if (DEBUG) {
			Log.e(TAG, "+++ ON RESUME +++");
		}
    	glSurfaceView.onResume();
    }
    
	// Call back when the activity is going into the background
    @Override
    protected synchronized void onPause() {
       super.onPause();
       if (DEBUG){
    	   Log.e(TAG, "+++ ON PAUSE +++");
       }
       glSurfaceView.onPause();
    }    
    
    @Override
    public void onStop() {
        super.onStop();
        if(DEBUG){
        	Log.e(TAG, "+++ ON STOP +++");
        }
    }

    public void onDestroy(){
    	super.onDestroy();
        if(DEBUG){
        	Log.e(TAG, "+++ ON DESTROY +++");
        }
    } 
}